<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>首页</title>
    <script type="text/javascript" src="/static/js/jquery-3.5.1.min.js"></script>
    <script type="text/javascript">
        function login() {
            $.ajax({
                url:"/user/login",
                type:"post",
                data:$("#loginForm").serialize(),
                success:function (msg) {
                    //把后端返回的token信息添加到请求头中去(拦截器中要从请求头中取出token信息进行对比)
                    //先把token信息保存到会话存储中
                    sessionStorage.setItem("token",msg)
                    location.href="/user/toSuccess"
                }
            });
        }
    </script>
    <script type="text/javascript">
        function reg() {
            location.href = "/user/lreg";
        }

    </script>
</head>
<body>

<form id="loginForm">
用户名：<input type="text" name="userName"
         placeholder="请输入用户名">
</br>
密码：<input type="password" name="passWord"
       placeholder="请输入密码">
    </br>
    <input type="button" value="登录" onclick="login()">
    <input type="button" value="注册" onclick="reg()">
</form>

</body>
</html>